package com.amos.wx.handler;

import com.amos.wx.mp.handler.AbstractMessageHandler;
import com.amos.wx.mp.handler.MessageHandlerFactory;
import com.amos.wx.mp.model.message.*;
import com.amos.wx.util.DateUtils;

import java.util.Date;

/**
 * @author Amos
 * @ClassName SubscribeEventMessageEvent
 * @Description TODO
 * @Date 2018/11/27 20:45
 * @VERSION 1.0
 **/
public class SubscribeEventMessageHandler extends AbstractMessageHandler<SubscribeEventMessage> {
    public SubscribeEventMessageHandler(MessageHandlerFactory messageHandlerFactory) {
        super(messageHandlerFactory);
    }
    @Override
    public ResponseMessage handleMessage(SubscribeEventMessage message) {
       switch (message.getEvent()){
           case subscribe:
               TextResponseMessage textResponseMessage = new TextResponseMessage();
               textResponseMessage.setContent("老弟，你来啦!");
               textResponseMessage.setTo(message.getFrom());
               textResponseMessage.setFrom(message.getTo());
               textResponseMessage.setMessageType(MessageType.text);
               textResponseMessage.setCreateTime(DateUtils.currentSecond());
               return textResponseMessage;
               default:
                   return new EmptyResponseMessage();
       }
    }
}
